home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 6 / Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso / 025a / gsdb25.zip / DB_XPL15.PAS < prev    next >
Pascal/Delphi Source File  |  1991-07-28  |  2KB  |  78 lines

  1. program DB_Xpl15;
  2. uses
  3.    CRT,
  4.    DOS,
  5.    GS_KeyI,
  6.    GS_Winfc,
  7.    GS_Date;
  8.  
  9. var
  10.    KeyinObj   : GS_KeyI_Objt;
  11.    CurDateVal,
  12.    WrkDateVal,
  13.    RecDateVal : GS_Date_ValTyp;
  14.    mm,
  15.    dd,
  16.    yy         : word;
  17.  
  18. function Date_Read(x,y : integer; defdate : longint) : GS_Date_ValTyp;
  19. var
  20.    t      : string[10];
  21.    tl     : integer;
  22.    okDate : boolean;
  23.    jul    : longint;
  24. begin
  25.    t := GS_Date_View(defdate);
  26.    repeat
  27.       GS_Wind_SetIVMode;
  28.       tl := length(t);
  29.       t := KeyInObj.EditString(t, x, y, tl);
  30.       GS_Wind_SetNmMode;
  31.       gotoxy(x,y);          {Go to start of field screen position}
  32.       write(t,'':tl-length(t));
  33.                             {Rewrite the string on screen in the original color}
  34.       jul := GS_Date_Juln(t);
  35.       if jul <> GS_Date_JulInv then OkDate := true else OkDate := false;
  36.       if not okDate then SoundBell(BeepTime,BeepFreq);
  37.    until okDate;
  38.    Date_Read := jul;
  39. end;
  40.  
  41.  
  42.  
  43.  
  44. begin
  45.  {
  46.    GS_Date_Century := true;
  47.  }
  48.    KeyInObj.Init;
  49.    CurDateVal := GS_Date_Curr;
  50.    ClrScr;
  51.    GoToXY(1,1);
  52.    Write('Current date is: ',GS_Date_View(CurDateVal));
  53.    GoToXY(40,1);
  54.    Write(CurDateVal);
  55.    RecDateVal := 0;
  56.    while RecDateVal <> CurDateVal do
  57.    begin
  58.       ClrScr;
  59.       GoToXY(1,1);
  60.       Write('Enter a date: ');
  61.       RecDateVal := Date_Read(15,1,CurDateVal);
  62.       GoToXY(1,2);
  63.       Writeln('Date in dBase storage format is: ',GS_Date_DBStor(RecDateVal));
  64.       Writeln('Date shown in "view" format is:  ',GS_Date_View(RecDateVal));
  65.       Writeln('Days between today and record date = ',
  66.                CurDateVal-RecDateVal:6);
  67.       Writeln('90 days after record date is: ',
  68.                GS_Date_View(RecDateVal+90));
  69.       GS_Date_Jul2MDY(RecDateVal,mm,dd,yy);
  70.       WrkDateVal := GS_Date_MDY2Jul(1,1,yy);
  71.       Writeln('Days since Jan 1 are: ',RecDateVal-WrkDateVal);
  72.       Writeln;
  73.       Writeln('Press any key');
  74.       WaitForKey;
  75.    end;
  76. end.
  77.  
  78.